clc 
close all
clear all
% This concurrency_smaples.mat file contains the following variables,
%
% concurrency_prks95  concurrency_prks90  concurrency_prks80  concurrency_prks70 
% concurrency_prks_l95  concurrency_prks_l90  concurrency_prks_l80  concurrency_prks_l70 
% concurrency_prks_r95  concurrency_prks_r90  concurrency_prks_r80  concurrency_prks_r70 

load concurrency_samples.mat

ALPHA=0.05;

MEAN = zeros(4,3);
Error_MEAN = zeros(4,3);
MEAN(1,1) = mean(concurrency_prks70);
MEAN(1,2) = mean(concurrency_prks_r70);
MEAN(1,3) = mean(concurrency_prks_l70);
Error_MEAN(1,1) =  norminv(1 - ALPHA / 2, 0, 1) * std(concurrency_prks70) / sqrt(size(concurrency_prks70, 1));
Error_MEAN(1,2) =  norminv(1 - ALPHA / 2, 0, 1) * std(concurrency_prks_r70) / sqrt(size(concurrency_prks_r70, 1));
Error_MEAN(1,3) =  norminv(1 - ALPHA / 2, 0, 1) * std(concurrency_prks_l70) / sqrt(size(concurrency_prks_l70, 1));

MEAN(2,1) = mean(concurrency_prks80);
MEAN(2,2) = mean(concurrency_prks_r80);
MEAN(2,3) = mean(concurrency_prks_l80);
Error_MEAN(2,1) =  norminv(1 - ALPHA / 2, 0, 1) * std(concurrency_prks80) / sqrt(size(concurrency_prks80, 1));
Error_MEAN(2,2) =  norminv(1 - ALPHA / 2, 0, 1) * std(concurrency_prks_r80) / sqrt(size(concurrency_prks_r80, 1));
Error_MEAN(2,3) =  norminv(1 - ALPHA / 2, 0, 1) * std(concurrency_prks_l80) / sqrt(size(concurrency_prks_l80, 1));

MEAN(3,1) = mean(concurrency_prks90);
MEAN(3,2) = mean(concurrency_prks_r90);
MEAN(3,3) = mean(concurrency_prks_l90);
Error_MEAN(3,1) =  norminv(1 - ALPHA / 2, 0, 1) * std(concurrency_prks90) / sqrt(size(concurrency_prks90, 1));
Error_MEAN(3,2) =  norminv(1 - ALPHA / 2, 0, 1) * std(concurrency_prks_r90) / sqrt(size(concurrency_prks_r90, 1));
Error_MEAN(3,3) =  norminv(1 - ALPHA / 2, 0, 1) * std(concurrency_prks_l90) / sqrt(size(concurrency_prks_l90, 1));

MEAN(4,1) = mean(concurrency_prks95);
MEAN(4,2) = mean(concurrency_prks_r95);
MEAN(4,3) = mean(concurrency_prks_l95);
Error_MEAN(4,1) =  norminv(1 - ALPHA / 2, 0, 1) * std(concurrency_prks95) / sqrt(size(concurrency_prks95, 1));
Error_MEAN(4,2) =  norminv(1 - ALPHA / 2, 0, 1) * std(concurrency_prks_r95) / sqrt(size(concurrency_prks_r95, 1));
Error_MEAN(4,3) =  norminv(1 - ALPHA / 2, 0, 1) * std(concurrency_prks_l95) / sqrt(size(concurrency_prks_l95, 1));

figure;
handle = barweb(MEAN, Error_MEAN,1, ['70';'80';'90';'95'], [], ['PDR requirement(%)'], ['Mean concurrency'], jet);
handle.legend =legend ('PRKS','PRKS-R','PRKS-L','orientation','horizontal');
set(gca,'fontsize',20);
box on
maximize ();
saveas(gcf, 'temp.fig');

%[im_hatch, colorlist]=applyhatch_pluscolor(gcf, '/-\xkc',1,[1 1 1 1 0 1],[],[],5,10);


